package com.example.demo.controller;

import com.example.demo.service.ScService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@Transactional
@RequestMapping("/sc")
public class ScController {
    @Autowired
    private ScService scService;
    @ApiOperation("删除学生记录")
    @RequestMapping("/deleteScBySno")
    public String deleteScBySno(@RequestParam("sno") int sno,@RequestParam("cno") int cno){
        scService.deleteScBySno(sno,cno);
        return "redirect:/student/getAllCourse";
    }
    @ApiOperation("添加课程")
    @RequestMapping("/insertSc")
    public String inserSc(@RequestParam("sno") int sno,@RequestParam("cno") int cno){
        scService.insertSc(sno,cno);
        return "redirect:/student/getAllCourse";
    }
}
